<?php

declare(strict_types=1);

namespace App\CustHub\Controller;

use App\CustHub\Annotation\ApiAuth;
use App\CustHub\Annotation\VerifySignature;
use App\CustHub\Constants\OperatorLogConstants;
use App\CustHub\Service\ChOperationLogService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use Mine\MineController;

#[Controller(prefix: 'ch/operation/log'),ApiAuth,VerifySignature]
class OperationLogController extends MineController
{

    #[Inject]
    protected ChOperationLogService $service;

    /**
     * 操作日志列表
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('list')]
    public function list(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getLogPageList($this->request->all()));
    }

    /**
     * 获取日志菜单
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getMenu')]
    public function getMenu(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success(OperatorLogConstants::getOptions());
    }
}